* This Stata do file will replicate all tables in
* "Ignorance is Bliss? Age, Misinformation, and Support for Women's Representation"
* by Barry C. Burden and Yoshikuni Ono
* Public Opinion Quarterly


* begin by placing data file in working directory
use "Burden_Ono_POQ_replication.dta"

* recode variables
gen age = 2018-birthyr
gen college = educ
recode college 1/3=0 3/6=1
gen dem = pid3
gen rep = pid3
recode dem 1=1 2/5=0
recode rep 1=0 2=1 3/5=0
gen white = race
recode white 2/8=0
gen black = race
gen hispanic = race
recode black 2=1 1=0 3/8=0
recode hispanic 3=1 1/2=0 4/8=0
gen newsmost = newsint
recode newsmost 1=1 2/7=0 32766=.
gen female = gender
recode female 1=0 2=1
recode followup_1 998=.
recode followup_2 998=.
recode followup_3 32766=.
label var followup_1 "Congress"
label var followup_2 "State Legislature"
gen congyes = followup_3
gen congno = followup_3
recode congyes 2/3=0
recode congno 1=0 3=0 2=1
gen stateyes = followup_4
gen stateno = followup_4
recode stateyes 2/3=0
recode stateno 1=0 3=0 2=1
gen foldedpid = pid7
recode foldedpid 1=4 2=3 3=2 4=1 5=2 6=3 7=4 8=.
recode ideo 6=.
replace ideo = ideo+1
gen religvimpt = pew_religimp
recode religvimpt 2/4=0
gen income_under40k = fam
gen income_40to80k = fam
gen income_over80k = fam
recode income_under40k 1/4=1 4/97=0
recode income_40to80k 1/4=0 5/8=1 9/97=0
recode income_over80k 1/8=0 9/16=1 97=0
gen educ2 = educ
gen educ3 = educ
gen educ4 = educ
gen educ5 = educ
gen educ6 = educ
recode educ2 1=0 2=1 3/6=0
recode educ3 1/2=0 3=1 4/6=0
recode educ4 1/3=0 4=1 5/6=0
recode educ5 1/4=0 5=1 6=0
recode educ6 1/5=0 6=1

* code women in state legislatures (both chambers are combined)
* source: https://www.cawp.rutgers.edu/women-state-legislature-2019
gen women_in_state_leg = inputstate
recode women_in_state_leg 1=15.7 2=38.3 4=38.9 5=23.7 6=30.8 8=46.0 9=33.2 ///
   10=24.2 11=. 12=30.0 13=30.5 15=31.6 16=31.4 17=35.6 18=24.0 19=30.0 ///
   20=27.9 21=22.5 22=16.0 23=38.2 24=38.8 25=28.5 26=35.8 27=31.8 28=13.8 ///
   29=24.9 30=30.0 31=28.6 32=52.4 33=34.2 34=30.8 35=34.8 36=32.4 37=25.9 ///
   38=21.3 39=26.5 40=21.5 41=40.0 42=26.5 44=38.1 45=15.9 46=23.8 47=15.2 ///
   48=23.8 49=24.0 50=40.0 51=26.4 53=40.8 54=14.2 55=27.3 56=15.6
   
* create measures of bias and accuracy
gen bias_1 = followup_1 - 24
gen bias_2 = followup_2 - women_in_state_leg 
gen accuracy_1 = abs(followup_1 - 24)
gen accuracy_2 = abs(followup_2 - women_in_state_leg) 
   
* TABLE 1. Explaining Bias in Beliefs about Women in Elected Office
sureg (bias_1 age female black hisp college income_* ///
  folded ideo religvimpt newsmost congyes congno) ///
  (bias_2 age female black hisp college income_* ///
  folded ideo religvimpt newsmost statey staten women_in) ///
  [aweight=weight], corr
  
* TABLE A1. Explanatory Variable Summary Statistcs and Correlations with Bias
summ bias_* accuracy_* age female black hisp college income_* folded ideo ///
  religvimpt newsmost congyes congno statey staten women_in [aweight=weight]  
corr bias_* accuracy_* age female black hisp college income_* folded ideo ///
  religvimpt newsmost congyes congno statey staten women_in [aweight=weight]   

* TABLE A2. Explaining Bias in Beliefs about Women in Elected Office by Gender
* women (columns 1 and 2)
sureg (bias_1 age black hisp college income_* ///
  folded ideo religvimpt newsmost congyes congno) ///
  (bias_2 age black hisp college income_* ///
  folded ideo religvimpt newsmost statey staten women_in) ///
  if female==1 [aweight=weight], corr   
* men (columns 3 and 4)
sureg (bias_1 age black hisp college income_* ///
  folded ideo religvimpt newsmost congyes congno) ///
  (bias_2 age black hisp college income_* ///
  folded ideo religvimpt newsmost statey staten women_in) ///
  if female==0 [aweight=weight], corr  
  
* TABLE A3. Incremental Models of Bias in Beliefs about Women in Elected Office
sureg (bias_1 age) ///
  (bias_2 age) ///
  [aweight=weight], corr  
sureg (bias_1 age female black hisp college income_* ) ///
  (bias_2 age female black hisp college income_* ) ///
  [aweight=weight], corr  
sureg (bias_1 age female  black hisp college income_* ///
  folded ideo religvimpt newsmost) ///
  (bias_2 age female  black hisp college income_* ///
  folded ideo religvimpt newsmost) ///
  [aweight=weight], corr
  
* TABLE A4. Explaining Accuracy in Beliefs about Women in Elected Office 
sureg (accuracy_1 age female black hisp college income_* ///
  folded ideo religvimpt newsmost congyes congno) ///
  (accuracy_2 age female black hisp college income_* ///
  folded ideo religvimpt newsmost statey staten women_in) ///
  [aweight=weight], corr
  
* TABLE A5. Models of Bias Including All Variables in Both Equations
sureg (bias_1 age female black hisp college income_* ///
  folded ideo religvimpt newsmost congyes congno statey staten women_in) ///
  (bias_2 age female black hisp college income_* ///
  folded ideo religvimpt newsmost congyes congno statey staten women_in) ///
  [aweight=weight], corr
  
* TABLE A6. Models with Multiple Educational Attainment Indicators  
sureg (bias_1 age female black hisp educ2-educ6 income_* ///
  folded ideo religvimpt newsmost congyes congno) ///
  (bias_2 age female black hisp educ2-educ6 income_* ///
  folded ideo religvimpt newsmost statey staten women_in) ///
  [aweight=weight], corr 
  
* TABLE A7. Models of Bias Party Identification Dummy Variables
sureg (bias_1 age female black hisp college income_* ///
  dem rep ideo religvimpt newsmost congyes congno) ///
  (bias_2 age female black hisp college income_* ///
  dem rep ideo religvimpt newsmost statey staten women_in) ///
  [aweight=weight], corr
  
